<html><head><title>If : Else : EndIf</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="5">If : Else : EndIf</font></b></p>

<br><b>Syntax</b><blockquote><pre><font face="Courier New, Courier, mono"size="2"><b><font color="#3A3966">If</font></b> &lt;expression&gt; 
  ...
[<b><font color="#3A3966">ElseIf</font></b> &lt;expression&gt;]
  ...
[<b><font color="#3A3966">Else</font></b>]
  ...
<b><font color="#3A3966">EndIf</font></b> 
</font></pre></blockquote>
<b>Description</b><br><blockquote>


The <b><font color="#3A3966">If</font></b> structure is used to achieve tests, and/or change the programmes direction, depending on whether the test is true or false. 
<b><font color="#3A3966">ElseIf</font></b> optional command is used for any number of additional tests if the previous test was not true. 
The <b><font color="#3A3966">Else</font></b> optional command is used to execute a part of code, if all previous tests were false. 
Any number of <b><font color="#3A3966">If</font></b> structures may be nested together. <br>
<br>
Short-circuit evaluations for expressions are supported, meaning if a test is true, all following tests will be ignored and not even run. 

</blockquote><p><b>Example:</b> Basic test</p><blockquote>


<pre><font face="Courier New, Courier, mono"size="2">  a = 5
  <b><font color="#3A3966">If</font></b> a = 10 
    <b><font color="#3A3966">Debug</font></b> &quot;a = 10&quot;
  <b><font color="#3A3966">Else</font></b>
    <b><font color="#3A3966">Debug</font></b> &quot;a &lt;&gt; 10&quot;
  <b><font color="#3A3966">EndIf</font></b>    
</font></pre>

</blockquote><p><b>Example:</b> Multiple test</p><blockquote>


<pre><font face="Courier New, Courier, mono"size="2">  b = 15
  <b><font color="#3A3966">If</font></b> a = 10 <b><font color="#3A3966">And</font></b> b &gt;= 10 <b><font color="#3A3966">Or</font></b> c = 20     
    <b><font color="#3A3966">If</font></b> b = 15
      <b><font color="#3A3966">Debug</font></b> &quot;b = 15&quot;
    <b><font color="#3A3966">Else</font></b>       
      <b><font color="#3A3966">Debug</font></b> &quot;Other possibility&quot;
    <b><font color="#3A3966">EndIf</font></b>   
  <b><font color="#3A3966">Else</font></b>     
    <b><font color="#3A3966">Debug</font></b> &quot;Test failure&quot;
  <b><font color="#3A3966">EndIf</font></b>  
</font></pre>

</blockquote><p><b>Example:</b> Short-circuit test</p><blockquote>


<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">Procedure</font></b> <font color="#3A3966">DisplayHello</font>()
    <b><font color="#3A3966">Debug</font></b> &quot;Hello&quot;
    <b><font color="#3A3966">ProcedureReturn</font></b> 1
  <b><font color="#3A3966">EndProcedure</font></b>

  a = 10
  <b><font color="#3A3966">If</font></b> a = 10 <b><font color="#3A3966">Or</font></b> <font color="#3A3966">DisplayHello</font>() = 1 <font color="#3A3966">; a is equal to 10, so the second test is fully ignored</font>
    <b><font color="#3A3966">Debug</font></b> &quot;Test success&quot;
  <b><font color="#3A3966">Else</font></b>     
    <b><font color="#3A3966">Debug</font></b> &quot;Test failure&quot;
  <b><font color="#3A3966">EndIf</font></b>  
</font></pre>
</body></html>